<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/1/12
  Time: 9:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>四大作用域数据展示</title>
</head>
<body>
    <h1>1. pageContext作用域展示<hr></h1>
    <%--    图书列表：${pageContext.books} <br>--%>
    <%
        List<String> books = (List<String>) pageContext.getAttribute("books");
        out.println("books-[pageContext作用域]:" + books);
    %>
    <h1>2. request作用域展示<hr></h1>
    图书列表：
    <%
        books = (List<String>) request.getAttribute("books");
        out.println("books-[request作用域]:" + books);
    %>
    <h1>3. session作用域展示<hr></h1>
    图书列表：
    <%
        books = (List<String>) session.getAttribute("books");
        String id = session.getId();
        out.println("sessionId:" + id + "<br>");
        out.println("books-[session作用域]:" + books);
    %>
    <br>
    <h1>4. application作用域展示<hr></h1>
    图书列表：
    <%
        books = (List<String>) application.getAttribute("books");
        out.println("books-[application作用域]:" + books);
    %>

</body>
</html>
